package mina;

import org.apache.mina.example.sumup.codec.SumUpProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.transport.socket.nio.NioSocketConnector;

public class TCPClient {
    
    private static final String HOSTNAME = "localhost";
    private static final int PORT = 8080;
    private static final long CONNECT_TIMEOUT = 30*1000L; // 30 seconds
    private static final boolean USE_CUSTOM_CODEC = true;

    public static void main(String[] args) {
        //
        NioSocketConnector connector = new NioSocketConnector();
        connector.setConnectTimeoutMillis(CONNECT_TIMEOUT);
        if(USE_CUSTOM_CODEC){
            connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new SumUpProtocolCodecFactory(false)));
    }
}
